package com.mate.cloud.transaction.controller;


import com.mate.cloud.common.response.BaseResponse;
import com.mate.cloud.common.web.controller.AdminBaseController;
import com.mate.cloud.transaction.service.TestTransactionService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 编程式事务
 *
 * @author: MI
 * @email: 448341911@qq.com
 * @createDate: 2023/10/29 18:19
 * @updateUser: MI
 * @updateDate: 2023/10/29 18:19
 * @updateRemark: 修改内容
 * @version: v1.0
 */
@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping("/tx")
public class TestTransactionController extends AdminBaseController {


    private final TestTransactionService testTransactionService;

    /**
     * 使用transaction manager实现编程性事务
     *
     * @return
     */
    @GetMapping("/manager")
    public BaseResponse testManager() {
        testTransactionService.testManager();
        return successCodeResponse();
    }
}
